package com.daohang361.imqq.pugin.decoder;

import org.apache.mina.core.session.IoSession;

import com.daohang361.imqq.Asycore.Connector;
import com.daohang361.imqq.Asycore.QQUser;
import com.daohang361.imqq.ServerContex.SessionContex;
import com.daohang361.imqq.decoder.InterfaceDecoder;
import com.daohang361.imqq.tool.MyByteReciveArray;

/** 
 * @author naner E-mail:likun3344@163.com 
 * @create time：2011-6-8 下午09:28:51 
 */
public class Decoder26 implements InterfaceDecoder{
	public MyByteReciveArray myArray;
	public QQUser sessionQQ;
	public byte[] decryptAll=null;
	@Override
	public void init(MyByteReciveArray myArray, QQUser sessionQQ) {
		this.myArray=myArray;
		this.sessionQQ=sessionQQ;
	}
	@Override
	public QQUser decode() throws Exception {
		System.out.println("I'M Pugin Decoder26");
		myArray.extract(0, 4);
		myArray.decryptRemain(sessionQQ.getAttr("imgKey"));
		
		byte[] token_data_26=myArray.extract(0, 3);//26携带数据
		
		sessionQQ.addAttr("token_data_26",token_data_26 );
		sessionQQ.setCommand(0x02);
		sessionQQ.addAttr("putImg", new byte[]{0x0});//通知主线程图片已上传OK
		Connector connector =SessionContex.getConnector(sessionQQ.getQq());
		IoSession Mainsession=connector.getSession();
		Mainsession.write(sessionQQ);
		return null;
	}
	
	/**
	 * 暴力打印
	 */
	public void violence()
	{
		//new ViolenceBytes(decryptAll).violence();
	}

	@Override
	public Object invoke(Object... o) {
		// TODO Auto-generated method stub
		return null;
	}
}
